<?php /* SVN: $Id: edit.ctp 2832 2010-08-26 05:34:48Z sakthivel_135at10 $ */ ?>
<div class="projects form user-profile-form project-edit-form round-5">
   <?php  if(empty($this->request->params['admin'])) {?>
	<div class="l-curve-top">
		<div class="r-curve-top">
			<div class="top-bg"></div>
		</div>
	</div>
	<div class="shad-bg-lft clearfix">
		<div class="shad-bg-rgt">
			<div class="shad-bg">
			<?php }?>
				<div class="main-section">
					<?php echo $this->Form->create('Project', array('class' => 'normal project-add clearfix','enctype' => 'multipart/form-data'));?>
			        <?php  if(empty($this->request->params['admin'])) {?>
                    	<h2><?php echo __l('Edit project');?></h2>
                    		<?php } ?>
						<div class="project-details project-form-content">
							<fieldset class="fields-block round-5">
								<!--<h3><?php echo __l('Project Info'); ?></h3>-->
								<div class="">
								<?php
									echo $this->Form->input('id');
									if($this->Auth->user('user_type_id') != ConstUserTypes::Admin):
										echo $this->Form->input('project_status_id',array('type'=>'hidden'));
									endif;
									echo $this->Form->input('name');
									echo $this->Form->input('short_description', array('type'=>'textarea','class' => 'js-description-count {"field":"js-short-description-count","count":"'.Configure::read('Project.project_short_description_length').'"}','label'=>__l('Short description'),'info' => __l('This text will be visible on projects home and list page.') . ' ' . '<span class="character-info">' . __l('You have') . ' ' . '<span id="js-short-description-count"></span>' . ' ' . __l('characters left') . '</span>'));
									echo $this->Form->input('description', array('type'=>'textarea', 'class' => 'js-editor', 'label'=>__l('Description'),'info'=>__l('Entered description will display in view page')));
									if($this->Auth->user('user_type_id') == ConstUserTypes::Admin):
										echo $this->Form->input('project_category_id', array('empty' => __l('Please select'),'label'=>__l('Project category')));
									else:
										echo $this->Form->input('project_category_id', array('type' => 'hidden'));
									endif;
								?>
								<div class="upload-image">
									<?php echo $this->Html->showImage('Project', $this->request->data['Attachment'], array('dimension' => 'big_thumb', 'alt' => sprintf('[Image: %s]', $this->Html->cText($this->request->data['Project']['name'], false)), 'title' => $this->Html->cText($this->request->data['Project']['name'], false))); ?>
									<?php echo $this->Form->input('Attachment.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload image'),'info'=>__l('Maximum allowed size ').Configure::read('Project.image.allowedSize').Configure::read('Project.image.allowedSizeUnits'),'class' =>'browse-field'));?>
								</div>
								</div>
						 </fieldset>
						</div>
						<fieldset class="project-add fields-block">
        				<h3 class="disk-usage legend"><?php echo __l('Media Files');?></h3>
     					<div class="">
						<?php
						
						if(!empty($this->request->data['ProjectMedia'])){?>
						<dl class="attachment-list">
							<dt></dt>
							<dd>
							<?php
								$attachments=array();
								foreach($this->request->data['ProjectMedia'] as $key => $media){
									unset($this->request->data['ProjectMedia'][$key]['description']);
									if(!empty($media['filename']['name'])){
									echo $this->Html->cText($media['filename']).'<p class="delete-block">'.$this->Html->link(__l('delete'), array('action' => 'delete_attachment', $this->request->data['Project']['id'],$media['id'],'admin'=>false) , array('class'=>'js-delete delete','escape' => false))."</p>";
									}
								}
								?>
							</dd>
						</dl>
						<?php }?>
				<div class="input gig-img-label">
				<?php echo $this->Form->input('ProjectMedia.0.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload Media File'), 'class' =>'browse-field'));?>
				<?php echo $this->Form->input('ProjectMedia.0.description', array('type' => 'text','size' => '33', 'label' => __l('Description'), 'class' =>'description-field'));?>
				<?php echo $this->Form->input('ProjectMedia.1.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload Media File'), 'class' =>'browse-field'));?>
				<?php echo $this->Form->input('ProjectMedia.1.description', array('type' => 'text','size' => '33', 'label' => __l('Description'), 'class' =>'description-field'));?>
				<?php echo $this->Form->input('ProjectMedia.2.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload Media File'), 'class' =>'browse-field'));?>
				<?php echo $this->Form->input('ProjectMedia.2.description', array('type' => 'text','size' => '33', 'label' => __l('Description'), 'class' =>'description-field'));?>
				<?php echo $this->Form->input('ProjectMedia.3.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload Media File'), 'class' =>'browse-field'));?>
				<?php echo $this->Form->input('ProjectMedia.3.description', array('type' => 'text','size' => '33', 'label' => __l('Description'), 'class' =>'description-field'));?>
				<?php echo $this->Form->input('ProjectMedia.4.filename', array('type' => 'file','size' => '33', 'label' => __l('Upload Media File'), 'class' =>'browse-field'));?>
				<?php echo $this->Form->input('ProjectMedia.4.description', array('type' => 'text','size' => '33', 'label' => __l('Description'), 'class' =>'description-field'));?>
				</div>
			
			
                <?php echo $this->Form->input('video_embed_url',array('label'=>__l('Video URL'),'info'=>__l('Enter video URL'))); ?>
	           </div>
                	</fieldset>
						<div class="project-details project-form-content">
							<fieldset class="fields-block round-5">
								<h3 class="disk-usage"><?php echo __l('Location'); ?></h3>
							<div class="">
								<div class="mapblock-info mapblock-info1">
									<div class="clearfix address-input-block">
										<?php echo $this->Form->input('Project.address', array('label' => __l('Address'), 'id' => 'ProjectAddressSearch', 'info' => __l('You must select address from autocomplete'))); ?>
									</div>
									<?php
								$class = '';
								if (empty($this->request->data['UserProfile']['address']) || ( !empty($this->request->data['UserProfile']['address1']) && !empty($this->request->data['City']['name']) &&  !empty($this->request->data['UserProfile']['country_id']))) {
									$class = 'hide';
								}
							?>
							<div id="js-geo-fail-address-fill-block" class="<?php echo $class;?>">
								<div class="clearfix">
									<div class="grid_16 omega alpha map-address-left-block address-input-block">
									<?php
										echo $this->Form->input('Project.latitude', array('id' => 'latitude', 'type' => 'hidden'));
										echo $this->Form->input('Project.longitude', array('id' => 'longitude', 'type' => 'hidden'));
										echo $this->Form->input('address1', array('id' => 'js-street_id','type' => 'text', 'label' => __l('Address')));
										echo $this->Form->input('country_id',array('id'=>'js-country_id', 'empty' => __l('Please select')));
										echo $this->Form->input('State.name', array('type' => 'text', 'label' => __l('State')));
										echo $this->Form->input('City.name', array('type' => 'text', 'label' => __l('City')));
									?>
									</div>
									</div>
									</div>
									<div class="grid_7 omega alpha grid_right js-side-map-div <?php echo $class;?>">
										<h3><?php echo __l('Point Your Location');?></h3>
										<div class="js-side-map">
											<div id="js-map-container"></div>
											<span><?php echo __l('Point the exact location in map by dragging marker');?></span>
										</div>
									</div>
									<div id="mapblock">
										<div id="mapframe">
											<div id="mapwindow"></div>
										</div>
									</div>
								</div>
								</div>
							</fieldset>
						</div>
						<div class="project-form-content websites">
							<fieldset class="fields-block round-5">
								<h3 class="disk-usage"><?php echo __l('Websites'); ?></h3>
								<div class="clearfix">
							    <?php
                					echo $this->Form->input('website_url' , array('label'=> __l('Home page URL'), 'class' =>'home'));
                                    echo $this->Form->input('linkedin_url' , array('label'=> __l('LinkedIn URL'), 'class' =>'linkedin'));
                                    echo $this->Form->input('facebook_url' , array('label'=> __l('Facebook URL'), 'class' =>'facebook'));
                                    echo $this->Form->input('twitter_url' , array('label'=> __l('Twitter URL'), 'class' =>'twitter'));
                                    echo $this->Form->input('youtube_url' , array('label'=> __l('YouTube URL'), 'class' =>'youtube'));
                                    echo $this->Form->input('myspace_url' , array('label'=> __l('MySpace URL'), 'class' =>'myspace'));
                                    echo $this->Form->input('imdb_url' , array('label'=> __l('IMDb URL'), 'class' =>'imdb'));
   				                ?>
								</div>
							</fieldset>
						</div>
						<?php if(Configure::read('Project.is_enable_rss_feed')): ?>
							<div class="project-form-content">
								<fieldset class="fields-block round-5">
									<h3 class="disk-usage"><?php echo __l('Project Updates'); ?></h3>
										<div class="">
									<?php
										if(Configure::read('Project.is_enable_rss_feed')):
											echo $this->Form->input('feed_url',array('label'=>__l('Feed URL'),'info'=>__l('Automatically fetch updates from the given feed URL')));
										endif;
									?>
									</div>
								</fieldset>
							</div>
						<?php 	endif; ?>
						<?php if(Configure::read('Project.is_enable_facebook_url') || Configure::read('Project.is_enable_twitter_url')): ?>
							<div class="project-form-content">
								<fieldset class="fields-block round-5">
									<h3 class="disk-usage"><?php echo __l('Social feeds'); ?></h3>
										<div class="">
									<?php
										if(Configure::read('Project.is_enable_facebook_url')):
											echo $this->Form->input('facebook_feed_url',array('label'=>__l('Facebook feed URL'),'info'=>__l('You can enter facebook URL from which you want to show feeds.')));
										endif;
										if(Configure::read('Project.is_enable_twitter_url')):
											echo $this->Form->input('twitter_feed_url',array('label'=>__l('Twitter username'),'info'=>__l('You can enter twitter username from which you want to show tweets. This widget is unavailable for private accounts.')));
										endif;
									?>
									</div>
								</fieldset>
							</div>
						<?php endif; ?>
						<div class="project-details project-form-content">
							<fieldset class="fields-block round-5">
								<h3 class="disk-usage"><?php echo __l('Funding'); ?></h3>
									<div class="">
								<?php
								if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending || $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea){
								$readonly_status = false;
                                }
                                else{
                                $readonly_status = true;
                                }
									if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending || $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea || ( (Configure::read('Project.is_allow_project_owner_to_edit_amount_in_open_status') || ($this->Auth->user('user_type_id') == ConstUserTypes::Admin)) && $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding)):
										echo $this->Form->input('needed_amount', array('readonly' => $readonly_status, 'label'=>__l('Needed amount').' ('.Configure::read('site.currency').')','info'=>sprintf(__l('Minimum Amount: %s%s <br/> Maximum Amount: %s'),Configure::read('site.currency'),$this->Html->cCurrency(Configure::read('Project.minimum_amount')), Configure::read('site.currency').$this->Html->cCurrency(Configure::read('Project.maximum_amount')))));
									else:
								?>
								<dl>
									<dt><?php echo __l('Amount').':' ?></dt>
										<dd><?php echo Configure::read('site.currency').$this->request->data['Project']['needed_amount'];?></dd>
								</dl>
								<?php
									endif;
									if (Configure::read('Project.is_enable_threshold_limit')):
						              $readonly = true;
						              if (Configure::read('Project.is_allow_project_owner_to_set_reserve_amount') || $this->Auth->user('user_type_id') == ConstUserTypes::Admin):
						              	$readonly = false;
					                  endif;
					                  if(isset($this->request->data['Project']['reserve_amount']))
						              {
                                        if($this->request->data['Project']['reserve_amount'] != '0')
                                        {
                                            $reserve_amount = $this->request->data['Project']['reserve_amount'];
                                        }
                                        else
                                        {
                                            $reserve_amount = '';
                                        }
                                        }
                                        else
                                        {
                                        if(Configure::read('Project.global_reserve_amount') != '0')
                                        {
                                            $reserve_amount = Configure::read('Project.global_reserve_amount');
                                        }
                                        else
                                        {
                                            $reserve_amount = '';
                                        }
                                      }
                                      if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending || $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea || ( (($this->Auth->user('user_type_id') == ConstUserTypes::Admin)) && $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding)):
					                      echo $this->Form->input('reserve_amount', array('readonly' => $readonly, 'value' => $reserve_amount, 'label' => __l('Reserve amount') . ' (' . Configure::read('site.currency') . ')'));
                                      else:
                                      ?>
                                        <dl>
									     <dt><?php echo __l('Reserve Amount').':' ?></dt>
									     	<dd><?php echo Configure::read('site.currency').$this->request->data['Project']['reserve_amount'];?></dd>
							            </dl>
                                      <?PHP
                                      endif;
					                endif;

								?>
								<?php
									if (Configure::read('Project.is_allow_extend_funding_end_date')) :
										if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending || $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea){
											$start_date = __l('today');
											$expiry_date=time();
										} else {
											echo $this->Form->input('project_funding_start_date', array('type' => 'hidden'));
											$start_date =$this->Html->cDate($this->request->data['Project']['project_funding_start_date']);
											$expiry_date=strtotime($this->request->data['Project']['project_funding_start_date']);
										}
								?>
								<div class="input date">
									<div class="js-datetime">
										<?php echo $this->Form->input('project_funding_end_date', array('type' => 'date', 'div' => false,'label'=>__l('Project Funding End Date'), 'orderYear' => 'asc')); ?>
									</div>
									<span class="info"><?php echo __l('Ending date should be within ') .Configure::read('Project.paypal_expiry_date'). __l(' days from project starting date').' '.$start_date .' . '.__l('Because paypal authorization will expire in ').Configure::read('Project.paypal_expiry_date'). __l(' days'); ?></span>
								</div>
								<?php
									endif;
									if ((Configure::read('Project.is_allow_user_to_set_overfunding') || ($this->Auth->user('user_type_id') == ConstUserTypes::Admin)) && Configure::read('Project.is_allow_over_funding')) :
										echo $this->Form->input('is_allow_over_funding',array('label'=>__l('Allow 0verfunding')));
									endif
								?>
								<div class="hide">
									<?php echo $this->Form->input('pledge_type_id', array('readonly' => $readonly_status, 'label'=>__l('Pledge type'),'class'=>'js-pledge-type')); ?>
								</div>
								<div class="js-min-amount hide">
									<?php echo $this->Form->input('min_amount_to_fund', array('readonly' => $readonly_status, 'label'=>__l('Amount'),'class'=>'js-pledge-type','info'=>__l('Fixed amount'))); ?>
								</div>
								</div>
							</fieldset>
						</div>
						<?php if(Configure::read('Project.is_enable_project_rewards') || !empty($this->request->data['ProjectReward']) ): ?>
							<div class="project-details project-form-content">
								<fieldset class="fields-block round-5">
									<h3 class="disk-usage"><?php echo __l('Reward'); ?></h3>
										<div class="">
									<?php if($this->request->data['Project']['project_status_id'] == ConstProjectStatus::Pending || $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForIdea || $this->Auth->user('user_type_id') == ConstUserTypes::Admin || (Configure::read('Project.is_allow_project_owner_to_edit_rewards_in_open_status')&& $this->request->data['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding)):?>
										<div class="content-info clearfix">
											<p><?php echo __l('The better the rewards, the faster you can meet your goal, and the more you will raise. Rewards can be real objects, experiences, or other cool stuff. But please keep them achievable and realistic.'); ?></p>
										</div>
										<?php
											if(Configure::read('Project.is_project_reward_optional')):
												$class = "not-required";
											endif;
										?>
										<div class="js-clone <?php echo $class; ?>">
											<span class ="js-add-more clone-add"><?php echo __l('Add more'); ?></span>
											<?php if(empty($this->request->data['ProjectReward'])):?>
												<div class="website-block js-field-list reward-block clearfix ">
													<?php
														if (!empty($this->request->data['ProjectReward']['0']['id'])):
															echo $this->Form->input('ProjectReward.0.id', array('type' => 'hidden'));
														endif;
														echo $this->Form->input('ProjectReward.0.pledge_amount',array('label'=>__l('Pledge amount').' ('.Configure::read('site.currency').')','info'=>__l('Reward amount')));
														echo $this->Form->input('ProjectReward.0.reward',array('info'=>__l('Reward')));
														echo $this->Form->input('ProjectReward.0.pledge_max_user_limit',array('label'=>__l('Pledge max user limit'),'info'=>__l('Maximum user allowed for this reward. Leave blank for no limit.')));
													?>
												</div>
											<?php else: ?>
											<?php
												$i=0;
												foreach($this->request->data['ProjectReward'] as $key => $projectReward) :
													$reward ='';
													if ($i!=0) {
														$reward=' reward-clone';
													}
											?>
												<div class="reward-block website-block clearfix js-field-list js-new-clone-<?php echo $i.$reward; ?>">
													<?php if($key):?>
														<span class="js-website-remove clone-remove"><?php echo __l('Remove'); ?></span>
													<?php endif;?>
													<?php
														if (!empty($this->request->data['ProjectReward'][$key]['id'])):
															echo $this->Form->input('ProjectReward.'.$key.'.id', array('type' => 'hidden'));
														endif;
														echo $this->Form->input('ProjectReward.'.$key.'.pledge_amount',array('label'=>__l('Pledge amount').' ('.Configure::read('site.currency').')','info'=>__l('Reward amount')));
														echo $this->Form->input('ProjectReward.'.$key.'.reward',array('info'=>__l('Reward')));
														echo $this->Form->input('ProjectReward.'.$key.'.pledge_max_user_limit',array('label'=>__l('Pledge max user limit'),'info'=>__l('Maximum user allowed for this reward. Leave blank for no limit.')));
													?>
												</div>
											<?php
													$i++;
												endforeach;
											?>
											<?php endif; ?>
										</div>
									<?php else: ?>
										<table class="list">
											<tr>
												<th class="js-pagination dr"><?php echo __l('Amount') . ' (' . Configure::read('site.currency') . ')';?></th>
												<th class="js-pagination dc"><?php echo __l('Reward');?></th>
												<th class="js-pagination"><?php echo __l('Pledge max user limit');?></th>
											</tr>
											<?php
												if (!empty($this->request->data['ProjectReward'] )):
													$i = 0;
													foreach($this->request->data['ProjectReward'] as $key => $projectReward) :
														$class = null;
														if ($i++ % 2 == 0) {
															$class = ' class="altrow"';
														}
											?>
											<tr<?php echo $class;?>>
												<td class="dr"><?php echo $this->Html->cCurrency($projectReward['pledge_amount']);?></td>
												<td class="dc"><?php echo $this->Html->cText($projectReward['reward']);?></td>
                                                <?PHP if($projectReward['pledge_max_user_limit'] == 0) { ?>
                                                   <td class="dc"><?php echo __l('Unlimited'); ?></td>
                                                <?PHP } else { ?>
                                                <td class="dc"><?php echo $this->Html->cInt($projectReward['pledge_max_user_limit']);?></td>
                                                <?PHP } ?>
											</tr>
											<?php
													endforeach;
												else:
											?>
											<tr>
												<td colspan="4" class="notice"><?php echo __l('No rewards available');?></td>
											</tr>
											<?php
												endif;
											?>
										</table>
									<?php endif; ?>
									</div>
								</fieldset>
							</div>
						<?php endif; ?>
						<?php if($this->Auth->user('user_type_id') == ConstUserTypes::Admin): ?>
							<div class="admin-project-details project-form-content">
								<fieldset class="fields-block round-5">
									<h3 class="disk-usage"><?php echo __l('Admin actions'); ?></h3>
								<div class="clearfix">
									<?php
										echo $this->Form->input('project_status_id', array('empty' => __l('Please select'),'label'=>__l('Project status')));
										echo $this->Form->input('is_active',array('label'=>__l('Active')));
										echo $this->Form->input('is_recommended',array('label'=>__l('Recommended')));
									?>
									</div>
								</fieldset>
							</div>
						<?php endif; ?>
						<div class="submit-block clearfix">
							<?php echo $this->Form->submit(__l('Update')); ?>
							<div class="cancel-block">
							<?PHP if($this->Auth->user('user_type_id') == ConstUserTypes::Admin): ?>
                                <?php echo $this->Html->link(__l('Cancel'), array('controller' => 'projects', 'action' => 'index'), array('title' => __l('Cancel'))); ?>
							<?PHP else: ?>
								<?php echo $this->Html->link(__l('Cancel'), array('controller' => 'users', 'action' => 'dashboard'), array('title' => __l('Cancel'))); ?>
							<?PHP endif; ?>
							</div>
						</div>
					<?php echo $this->Form->end(); ?>
				</div>
	  <?php  if(empty($this->request->params['admin'])) {?>
			</div>
		</div>
	</div>
	<div class="l-curve-bot">
		<div class="r-curve-bot">
			<div class="bot-bg"></div>
		</div>
	</div>
	<?php }?>
 <?php  if(Configure::read('Project.project_layout') != ConstViewLayout::CompactView){ ?>

<div class="grid_6 alpha preview-content omega">
						<div class="l-curve-top">
							<div class="r-curve-top">
                                <div class="top-bg"></div>
                            </div>
						</div>
						<div class="shad-bg-lft clearfix">
							<div class="shad-bg-rgt">
								<div class="shad-bg">






							<div class="collections-side2 clearfix">
								<div class="center-top clearfix">
									<div class="small-description">
										<div class="project-head">
													<h3 class="js-name">
													<?php $project_name=!empty($this->request->data['Project']['name'])?$this->request->data['Project']['name']: __l('Project name');
													echo $project_name ;?></h3>
															<p> <?php
													$username=!empty($this->request->data['User']['name'])?$this->request->data['User']['name']:$project['User']['username'];

													echo __l('by') . ' '; ?><?php echo $this->Html->link($this->Html->cText($username), array('controller' => 'users', 'action' => 'view', $username), array('escape' => false, 'title' => $this->Html->cText($username, false)));?>
                                                    </p>
										</div>
                                        <?php echo $this->Html->showImage('Project', $this->request->data['Attachment'], array('dimension' => 'big_thumb'),array('aspect_ratio'=>1)); ?>
                                        <p class="description-content js-short-description"><?php $short_description=!empty($this->request->data['Project']['short_description'])?$this->request->data['Project']['short_description']:__l('Short description');
                                             echo  $this->Html->truncate($this->Html->cText($short_description, false), 140);?>
                                        </p>
									</div>

            						<div class="clearfix">
                                        <dl class="fb-list clearfix grid_left">
                                          <dt class="grid_left"><?php echo $this->Html->cInt($project['Project']['project_fund_count']); ?></dt>
										  <dd class="grid_left"><?php echo __l("Backers"); ?></dd>
                                        </dl>
                                        <dl class="fb-list grid_right clearfix">
                                          <dt class="grid_right"><?php echo __l("Followers"); ?></dt>
                                          <dd class="grid_right"><?php echo $this->Html->cInt($project['Project']['project_follower_count']); ?></dd>
                                        </dl>
                                      </div>
                                    <div class="clearfix">
						                <dl class="feature-list clearfix">
											<?php if (Configure::read('Project.is_project_comment_enabled') && !Configure::read('Project.is_fb_project_comment_enabled')): ?>
												<dt class="comments" title="<?php echo __l('Comments'); ?>"><?php echo __l('Comments:') . ' '; ?></dt>
													<dd><?php echo $this->Html->link($this->Html->cInt($project['Project']['project_comment_count']), array('controller' => 'projects', 'action' => 'view', $project['Project']['slug'], '#_Comments'), array('escape' => false)); ?></dd>
											<?php endif; ?>
											<dt class="updates" title="<?php echo __l('Updates'); ?>"><?php echo __l('Updates:') . ' '; ?></dt>
												<dd>
													<?php
														if(!empty($project['Project']['feed_url']) && Configure::read('Project.is_enable_rss_feed')){
															echo $this->Html->link($this->Html->cInt($project['Project']['project_feed_count']), array('controller' => 'projects', 'action' => 'view', $project['Project']['slug'], '#_Updates'), array('escape' => false));
														} else{
															echo $this->Html->link($this->Html->cInt($project['Project']['blog_count']), array('controller' => 'projects', 'action' => 'view', $project['Project']['slug'], '#_Updates'), array('escape' => false));
														}
													?>
												</dd>
											<dt class="views" title="<?php echo __l('Views'); ?>"><?php echo __l('Views:') . ' '; ?></dt>
												<dd><?php echo $this->Html->link($this->Html->cInt($project['Project']['project_view_count']), array('controller' => 'projects', 'action' => 'view', $project['Project']['slug']), array('escape' => false)); ?></dd>
												</dl>
												<dl>
												<?php
												
												$location = array();
												$place = '';
												if (!empty($project['City'])) 
													$location[] = $project['City']['name'];
												
												if (!empty($project['Country'])) 
													$location[] = $project['Country']['name'];
											
												$place = implode(', ', $location);
												if ($place)
													if (!empty($project['Country']['iso2']))
													{
													?>
													
													<dd>
													<span class="flags flag-<?php echo strtolower($project['Country']['iso2']); ?>" title ="<?php echo $project['Country']['name']; ?>"><?php echo $project['Country']['name']; ?></span> 
													<?php 
													}
												echo $this->Html->link($place, array('controller' => 'projects', 'action' => 'index', 'city'=>$project['City']['slug'],'admin'=>false), array('escape' => false));?></dd></dl>
										
										<?php if (Configure::read('Project.is_enable_idea')): ?>
											<div class=" clearfix vote-count vote-count-small">
												<div class="js-rating-display">
						                             <?php
														$average_rating = (!empty($project['Project']['project_rating_count'])) ? ($project['Project']['total_ratings']/$project['Project']['project_rating_count']) : 0;
														echo $this->element('_star-rating', array('project_id' => $project['Project']['id'], 'current_rating' => $average_rating, 'total_rating' => $project['Project']['total_ratings'],'rating_count' => $project['Project']['project_rating_count'],'canRate' => 0));
													?>
													<ul class="list count-list clearfix">
														<li class="supporters" title="<?php echo __l('supporters'); ?>"><?php echo $this->Html->cInt($project['Project']['project_rating_count']); ?></li>
															<li class="average" title="<?php echo __l('average'); ?>"><?php echo $this->Html->cInt($average_rating); ?></li>
													</ul>
												</div>
											</div>
										<?php endif; ?>
									</div>
									<?php 
									$collected_percentage = ($project['Project']['collected_percentage']) ? $project['Project']['collected_percentage'] : 0; ?>
								</div>
					             <div class="progress-inner clearfix">
											<div class="progress-block clearfix">
												<p class="progress-bar progress-bar-amount" title = '<?php echo $this->Html->cFloat($collected_percentage,false).'%'; ?>'>
													<span style="width:<?php echo ($collected_percentage > 100) ? '100%' : $collected_percentage.'%'; ?>;" title = "<?php echo $this->Html->cFloat($collected_percentage,false).'%'; ?>"></span>
												</p>
											</div>
											<div class="clearfix">
											<dl class="deal-value grid_2">
														<dt><?php echo __l('funded') ?></dt>
														<dd><?php echo $this->Html->cInt($collected_percentage). __l('%');?></dd>
												</dl>
												<dl class="deal-discount grid_2 alpha omega">
													<dt><?php echo __l('pledged') ?></dt>
													<dd><?php echo Configure::read('site.currency') . $this->Html->cCurrency($project['Project']['collected_amount']); ?></dd>
												</dl>
												<dl class="deal-save grid_left alpha omega">
													<?php if (!empty($project['Project']['project_fund_goal_reached_date']) && $project['Project']['project_fund_goal_reached_date'] != '0000-00-00 00:00:00'): ?>
												<dt><?php echo $this->Html->cDateTimeHighlight($project['Project']['project_fund_goal_reached_date']); ?></dt>
													<dd><?php echo __l('funded'); ?></dd>
											<?php elseif($project['Project']['project_status_id'] == ConstProjectStatus::FundingExpired): ?>
												<dt><?php echo $this->Html->cDateTimeHighlight($project['Project']['project_funding_end_date']); ?></dt>
													<dd><?php echo __l('expired'); ?></dd>
											<?php elseif($project['Project']['project_status_id'] == ConstProjectStatus::ProjectCancelled): ?>
												<dt><?php echo $this->Html->cDateTimeHighlight($project['Project']['project_cancelled_date']); ?></dt>
													<dd><?php echo __l('Cancelled'); ?></dd>
											<?php else: ?>
												<dt><?php if(round($project[0]['enddate']) >0) { echo  __l('days to go'); } else{  echo  __l('hours to go'); } ?></dt>
													<dd>
														<?php
															if ($project['Project']['project_status_id'] == ConstProjectStatus::OpenForFunding || $project['Project']['project_status_id'] == ConstProjectStatus::ReserveAmountReached || $project['Project']['project_status_id'] == ConstProjectStatus::GoalReached):
																if(round($project[0]['enddate']) >0):
																	echo $this->Html->cInt($project[0]['enddate']);
																else:
																	$end_time = intval(strtotime($project[0]['enddate'] . ' 23:59:59') - time());
														?>
														<div class="time-count">
															<div class="js-countdown">&nbsp;</div>
															<span class="js-time hide"><?php echo $this->Html->cInt($end_time,false);?></span>
														</div>
														<?php
																endif;
															endif;
														?>
													</dd>
                                 			<?php endif; ?>

											  </dl>
											</div>
									</div>
							</div>


														</div>
							</div>
						</div>
						<div class="l-curve-bot">
							<div class="r-curve-bot">
						      	<div class="bot-bg"></div>
                            </div>
						</div>
					</div>

<?php } ?>
</div>